//获取标签
var searchEle = document.querySelector('.main .search')
var inputEle = document.querySelector('.main input')
searchEle.onclick = () => {
    axios.get('/user/search', { params:{searchkey: inputEle.value} }).then((res) => {
        render(res.data.list)
        console.log(res.data);
    })
}


axios.get('/user/list', { params: { page: 1, count: 2 } }).then((res) => {
    render(res.data.list)
    console.log(res.data);
})
axios.post('/user/login',{mingchen:'董事长',bianma:ceo}).then((res) => {
    console.log(res.data);
})

//渲染
function render(data) {
    var str = ''
    var str = data.map((item, index) => {
        return `<tr>
                    <td><input type="radio"></td>
                    <td>${item.bianhao}</td>
                    <td>${item.bianma}</td>
                    <td>${item.mingchen}</td>
                    <td>${item.paixu}</td>
                    <td><span class="zhengchang">${item.mingchen?'正常':'异常'}</span></td>
                    <td>${item.time}</td>
                    <td><span class="iconfont icon-bianji" style="margin-right:10px ;"></span><span class="iconfont icon-shanchu"></span></td>
                </tr>`
    }).join('')
    if(str == ' '){
        str = `<ul style="color:red;">未查询到数据</ul>`
    }
    document.querySelector('tbody').innerHTML = str;
}

